package com.qijian.production.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qijian.production.domain.ScWorkOrder;
import com.qijian.production.domain.ScWorkOrderDetail;
import com.qijian.production.domain.query.ScWorkOrderDetailQuery;
import com.qijian.production.domain.query.ScWorkOrderQuery;
import com.qijian.production.domain.vo.ScWorkOrderDetailVo;
import com.qijian.production.domain.vo.ScWorkOrderVo;
import com.qijian.production.domain.vo.WorkOrderExcelVo;

import java.util.List;

import java.util.List;
import java.util.Set;

/**
 * 生产计划单Service接口
 *
 * @author zhangcheng
 * @date 2025-03-25
 */
public interface IScWorkOrderService extends IService<ScWorkOrder> {

    /**
     * 订单列表
     * @param page
     * @param query
     * @return
     */
    Page<ScWorkOrderVo> pageVo(Page<ScWorkOrder> page, QueryWrapper<ScWorkOrderQuery> query);

    /**
     * 订单详情列表
     * @param page
     * @param query
     * @return
     */
    Page<ScWorkOrderVo> pageDetailVo(Page<ScWorkOrder> page, QueryWrapper<ScWorkOrderQuery> query);

    /**
     * 订单详情列表
     * @param query
     * @return
     */
    List<ScWorkOrderVo> listDetailForProduction(ScWorkOrderDetailQuery query);

    ScWorkOrderVo getOrderDetailDataByQuery(ScWorkOrderQuery query);

    List<ScWorkOrderVo> getChildWorkOrder(Long workOrderId);

    List<ScWorkOrderVo> getNeedItem(Long workOrderId, Long workOrderDetailId);

    /**
     * 生产计划单导入
     * @param list
     * @return
     */
    Boolean importWorkOrder(List<WorkOrderExcelVo> list);

    /**
     * 开工
     * @param id
     * @return
     */
    Boolean startWork(Long id);

    /**
     * 结单
     * @param id
     * @return
     */
    Boolean workOver(Long id);

    ScWorkOrderVo getMaxSortData(Long workOrderId);

    /**
     * 拆单
     * @param ids
     * @return
     */
    Boolean split(Set<Long> ids);

    /**
     * 获取报工详情数据
     * @param detailId
     * @return
     */
    ScWorkOrderDetailVo getReportingData(Long detailId);

    /**
     * 工单列表
     * @param query
     * @return
     */
    List<ScWorkOrderDetailVo> listDetail(QueryWrapper<ScWorkOrderDetailQuery> query);

    /**
     * 分页工单列表
     * @param page
     * @param query
     * @return
     */
    Page<ScWorkOrderDetailVo> pageDetail(Page<ScWorkOrderDetail> page, QueryWrapper<ScWorkOrderDetailQuery> query);

    ScWorkOrderVo getPassRateReportHead(ScWorkOrderQuery scWorkOrderQuery);

    Page<ScWorkOrderVo> getPassRateReportBody(Page<ScWorkOrder> page, ScWorkOrderQuery scWorkOrderQuery);
}
